class RenamingOrderColumns < ActiveRecord::Migration
  COLUMNS = [[:ship_to_first_name, :first_name],
             [:ship_to_last_name, :last_name],
             [:ship_to_address, :address1],
             [:ship_to_city, :city],
             [:ship_to_state, :state],
             [:ship_to_postal_code, :zip]]
  
  def self.up
#    rename_column(:orders, :ship_to_first_name, :first_name)
#    rename_column(:orders, :ship_to_last_name, :last_name)
#    rename_column(:orders, :ship_to_address, :address1)
#    rename_column(:orders, :ship_to_city, :city)
#    rename_column(:orders, :ship_to_state, :state)
#    rename_column(:orders, :ship_to_postal_code, :zip)
    COLUMNS.each {|c| rename_column(:orders, c[0], c[1])}
  end

  def self.down
#    rename_column(:orders, :first_name, :ship_to_first_name)
#    rename_column(:orders, :last_name, :ship_to_last_name)
#    rename_column(:orders, :address1, :ship_to_address)
#    rename_column(:orders, :city, :ship_to_city)
#    rename_column(:orders, :state, :ship_to_state)
#    rename_column(:orders, :zip, :ship_to_postal_code)
    COLUMNS.each {|c| rename_column(:orders, c[1], c[0])}
  end
end
